﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Database.Connections;
namespace Flexfield
{
    internal class EntityContextDB : DataContextDB
    {
        private Connection  _dbmanager;
     
        internal Connection DBManager
        {
            get { return _dbmanager; }
        }

     
        /// <summary>
        /// Ctor only be called in operational object
        /// </summary>
        internal EntityContextDB(string name ,string logdirectory)
        {

             _dbmanager = ConnectionPoolManager.GetConnection(name).getConnection();
             

            //check if database is exist or not if not then create it
            //Database.DatabaseInstall install = new Database.DatabaseInstall( 
            //                                    builder.Provider, builder.DataSource);

            ///Desbloq/////Database.DatabaseInstall install = new Database.DatabaseInstall(
            ////////                                    Database.GDatabaseType.Access, builder.DataSource);

            
        }

     

        public override void Initialize()
        {
            //_book = new BookRepository(this);
            //_customer = new CustomerRepository(this);
            //_author = new AuthorRepository(this);
            //_transaction = new TransactionRepository(this);
            //_users = new UsersRepository(this);
            //_schoolyear = new SchoolYearRepository(this);
            _flex = new Flexfield(this);
            //_section = new SectionRepository(this);
            //_sectionoffering = new SectionOfferingRepository(this);
            //_mencion = new MencionRepository(this);

        }
    }
}